<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>v-on指令</title>
</head>

<body>
    <div id="app">
        <button @click="fn">切换</button>
        <h1 v-show="isTrue">点击切换按钮切换显示|隐藏状态</h1>
    </div>
</body>

</html>
<script src="https://cdn.bootcss.com/vue/2.6.11/vue.min.js"></script>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            isTrue: true
        },
        methods: {
            /* 改变isTrue的值，实现显示和隐藏的效果 */
            fn: function () {
                this.isTrue = !this.isTrue;
            }
        }
    })
</script>